using System.IO;

namespace Inheritance
{
    public class Polygon
    {
        private int _sides;
        private int _interior_angles;

        public string _name
        {
            get { return _name; }
            set
            {
                _name = value;
            }
        }
        public int Sides
        {
            get { return _sides; }
            set
            {
                if (value < 3)
                {
                    throw new ArgumentException("边数必须大于3且为整数");
                }
                _sides = value;
            }
        }

        public int Interior_Angles
        {
            get{ return _interior_angles; }
            set
            {
                _interior_angles = (_sides - 2) * 180;
            }
        }
    }

    public class Triangle : Polygon
    {
        public string _name = "三角形";
        public int _sides = 3;

        public int _interior_angles = 180;
    }
}